import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.test.context.junit4.SpringRunner;
import top.xiaoshuaila.searescue.SearescueApplication;
import top.xiaoshuaila.searescue.mqtt.EmqClient;
import top.xiaoshuaila.searescue.mqtt.MqttProperties;
import top.xiaoshuaila.searescue.serialport.utils.ByteUtils;

import java.time.LocalDateTime;
import java.util.Arrays;

@SpringBootTest(classes = SearescueApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class test {
    @Autowired
    private EmqClient emqClient;
    @Autowired
    private MqttProperties mqttProperties;
    @Test
    public void test1() throws Exception {
        System.out.println(mqttProperties.getUsername());
        emqClient.connect(mqttProperties.getUsername(), mqttProperties.getPassword());
        emqClient.connect(mqttProperties.getUsername(), mqttProperties.getPassword());
        emqClient.connect(mqttProperties.getUsername(), mqttProperties.getPassword());
        emqClient.substribe("lalala",1);
        while (true);
    }
    @Test
    public void test2(){
        emqClient.connect(mqttProperties.getUsername(), mqttProperties.getPassword());
        emqClient.publish("lalala","lalala",1,false);
    }
    @Test
    public void test3(){
        System.out.println(ByteUtils.LRC("01 03 00 00 00 32 "));
    }
}